<%layout("/common/_layout.html"){ %>
<%#ajax userTable:{%>
<div class="am-cf am-padding">
    <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">报表中心</strong> /
        <small>赢话费活动报表</small>
    </div>
</div>
<div class="am-g">
    <div class="am-u-sm-12">
        <form class="am-form" id="list-form" action="${base}/activityCityBusinessReport/list" method="post">
            <input type="hidden" id="keywords" name="keywords" value='${keywords!""}'/>
            <input type="hidden" id="isExport" name="isExport" value='${isExport!"0"}'/>
            <table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">
                <tbody>
                <tr>                   
                    <th class="am-text-middle">按日统计日期</th>
                    <td>
                        <div class="am-u-sm-10">
                            <div class="am-form am-form-inline">
                                <div class="am-form-group am-form-icon">
                                    <i class="am-icon-calendar"></i>
                                    <input type="text" class="am-form-field am-input-sm" id="select_date"
                                           value="${select_date!}" placeholder="开始日期" data-am-datepicker>
                                </div>                               
                                <span style="color: red;">默认显示今天的统计数据</span>
                            </div>
                        </div>
                    </td>
                    <th class="am-text-middle">按月统计月份</th>
                    <td>                       
                        <div class="am-u-sm-10">
                            <div class="am-form am-form-inline">
                                <div class="am-form-group">
                                    <select data-am-selected="{btnSize:'sm',maxHeight: 400}" name="select_month" id="select_month">
                                        <%for(item in monthList){%>
                                        <option value="${item}"
                                        <%if(select_month==item){%>
                                        selected
                                        <%}%>>${item}</option>
                                        <%}%>
                                    </select>
                                </div>
                                <span style="color: red;">默认显示本月的统计数据</span>
                            </div>                            
                        </div>
                    </td>                                       
                </tr>
                <tr>                    
                    <td colspan="4"> 
                        <div class="am-g">                                          
                            <div class="am-u-sm-11" align='right'>
                                <button type="button" class="am-btn am-btn-default am-btn-sm am-text-secondary"
                                    id="submit-btn">统计
                                </button>                              
                                <button type="button" class="am-btn am-btn-default am-btn-sm am-text-secondary" id="export-btn">导出</button>                     
                            </div>
                        </div>
                    </td>       
                </tr>               
                </tbody>
            </table>
        </form>
    </div>    
</div>
<div class="am-g">
    <div class="am-u-sm-6">        
        <div class="am-scrollable-horizontal">            
            <table class="am-table am-table-striped am-table-hover table-main">              
                <thead>
                    <tr>
                        <td colspan="5">
                            <div class="am-u-sm-12"  style="text-align:center"><span align="center"><strong>按日统计数据(${select_date!})</strong></span></div>
                        </td>
                    </tr>
                    <tr class="am-text-nowrap">
                        <th class="table-title">地市</th>
                        <th class="table-title">办理5笔指定业务及以上人数</th>                    
                        <th class="table-title">销售4G+终端人数</th>
                        <%if(is_province_account =="1"){%>
                        <th class="table-title">操作</th>
                        <%}%>
                    </tr>
                </thead>
                <tbody>
                    <%for(city in dayCityList){%>
                    <tr>                       
                        <td>${city.DisplayName!''}</td>                    
                        <td>${city.cnt20!'--'}</td>
                        <td>${city.cnt30!'--'}</td>
                        <%if(is_province_account =="1"){%>
                        <td>
                            <button onclick="location.href='${base!}/activityCityBusinessReport/listArea?city_code=${city.id}'" type="button" class="am-btn am-btn-default am-btn-xs am-text-secondary" ><span class="am-icon-pencil-square-o"></span>查看区县详情</button>
                        </td>
                        <%}%>
                    </tr>
                    <%}%>
                </tbody>
            </table>
        </div>
    </div>
     <div class="am-u-sm-6">        
        <div class="am-scrollable-horizontal">            
            <table class="am-table am-table-striped am-table-hover table-main">      
                <thead>
                    <tr>
                        <td colspan="5">
                        <div class="am-u-sm-12" style="text-align:center"><span><strong>按月统计(${monthTitle})</strong></span></div> 
                        </td>            
                    </tr>
                    <tr class="am-text-nowrap">
                        <th class="table-title">地市</th>
                        <th class="table-title">办理5笔指定业务及以上人数</th>                    
                        <th class="table-title">销售4G+终端人数</th>
                        <%if(is_province_account =="1"){%>
                        <th class="table-title">操作</th>                  
                        <%}%>
                    </tr>
                </thead>
                <tbody>
                    <%for(city in cityMonthList){%>
                    <tr>                       
                        <td>${city.DisplayName!''}</td>                    
                        <td>${city.cnt20!'--'}</td>
                        <td>${city.cnt30!'--'}</td>
                        <%if(is_province_account =="1"){%>
                        <td>
                            <button onclick="location.href='${base!}/activityCityBusinessReport/listArea?city_code=${city.id}&select_month=${select_month}&select_date=${select_date}'" type="button" class="am-btn am-btn-default am-btn-xs am-text-secondary" ><span class="am-icon-pencil-square-o"></span>查看区县详情
                            </button>
                        </td>                    
                        <%}%>
                    </tr>
                    <%}%>
                </tbody>                
            </table>            
        </div>
    </div>   
</div>
<script type="text/javascript">
    $(function () {
        var keywordsObj = {};

        function setKeyWords() {           
            if ($("#select_date").val())
                keywordsObj.select_date = $("#select_date").val();
            if($("#select_month").val())             
                keywordsObj.select_month = $("#select_month").val();
            
            var keywords = "";
            if (!$.isEmptyObject(keywordsObj)) {
                keywords = JSON.stringify(keywordsObj);
            }
            console.log("keywords = " + keywords);
            $("#keywords").val(keywords);
        }

        $("#submit-btn").on("click", function () {
            setKeyWords();    
            $("#isExport").val("0");       
            $("#list-form").submit();
        });        
        $("#export-btn").on("click",function(){
            setKeyWords();
            $("#isExport").val("1");
            $("#list-form").submit();
        });
    });

</script>
<%}%>
<%}%>